Geospatial queries using associated distribution data

ABSTRACT

Embodiments of the present invention disclose a method, computer program product, and system for optimizing spatial queries, the method comprising a computer receiving a spatial data set, and a target spatial shape. The computer determining a distribution data set which aligns with the geometry of the spatial data set. The computer performing a query to determine a list of full and partial shapes of the spatial data set located within the target spatial shape. The computer determining a ratio for a determined partial shape of the spatial data set using the distribution data set. The computer determining an apportioned value of a variable of the spatial data set within the determined partial shape. The computer summarizing into a result set the value of the variable within the determined list of full and partial shapes of the spatial data set.

FIELD OF THE INVENTION

The present invention relates generally to the field of data processing,and more particularly to optimizing the joining of geospatial data setsin queries.

BACKGROUND OF THE INVENTION

A geographic information system (GIS) is a system designed to capture,store, analyze, and present many types of data that are linked to aspatial location or area. In the simplest terms, GIS is the merging ofcartography, statistical analysis, and database technology. Examples ofdata that are geographically oriented are population census blocks,county property tax maps, and postal zip codes.

A GIS is typically custom-designed for the needs of an organization, andthe spatial boundaries of each data subset may be represented bysquares, rectangles, polygons, curves, or other complex shapes. Theshapes of spatial area boundaries may be jurisdictional, purpose, orapplication oriented. GIS uses spatial-temporal location as the keyindex variable for all information being collected into the GISdatabase. Location data may be recorded, for example, as dates/times ofoccurrence, along with a combination of longitude, latitude, andelevation. The coordinates ultimately refer to physical locations oritems such as highway mile markers, surveyor benchmarks, or streetintersections.

Generally, GIS applications are tools that allow users to createinteractive searches, analyze spatial information, edit data in maps,and present the results of these operations. Examples of GIS softwareapplications are Esri ArcGIS®, which is a commercial suite of GISapplications, and Natural Earth, which is an open source map data set.ArcGIS® is a registered trademark of Esri in the United States, theEuropean Community, or certain other jurisdictions. The Open GeospatialConsortium (OGC), originating in 1994, developed standards forgeospatial content and services, GIS data processing and data sharing.The OGC created a features and geometry specification, and setsstandards for adding spatial functionality to database systems. Aspatial database management system is optimized to store and query datathat represents objects defined in a geometric space using a geometry orfeature, such as a polygon representing a county border.

SUMMARY

Embodiments of the present invention disclose a method, computer programproduct, and system for optimizing spatial queries, the methodcomprising a computer receiving a first spatial data set and a targetspatial shape, wherein the geometry of the first spatial data set doesnot align with the geometry of the target spatial shape. The computerdetermining a distribution data set, wherein the geometry of thedistribution data set aligns with the geometry of the first spatial dataset. The computer performing a query to determine a list of full andpartial shapes of the first spatial data set which are located withinthe target spatial shape. The computer determining a ratio for adetermined partial shape of the first spatial data set using thedistribution data set. The computer determining an apportioned value ofa variable of the first spatial data set within the determined partialshape, wherein the apportioned value of the variable is calculated bymultiplying a full value of the variable with the determined ratio. Thecomputer summarizing into a result set the value of the variable withinthe determined list of full and partial shapes of the first spatial dataset.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 is a block diagram illustrating a distributed data processingenvironment, in accordance with an embodiment of the present invention.

FIG. 2A is an illustration of a first geospatial data set, in accordancewith an embodiment of the present invention.

FIG. 2B is an illustration of a second geospatial data set, inaccordance with an embodiment of the present invention.

FIG. 2C is an illustration of a union query and an intersection query oftwo geospatial data sets, in accordance with an embodiment of thepresent invention.

FIG. 2D is an illustration of an optimized join of two geospatial datasets, in accordance with an embodiment of the present invention.

FIG. 2E is an illustration of a distribution data set, in accordancewith an embodiment of the present invention.

FIG. 2F is an illustration of a target shape overlaid onto a singlegeospatial data set, in accordance with an alternate embodiment of thepresent invention.

FIG. 3 is a flowchart depicting the operational steps of a geospatialapplication, in accordance with an embodiment of the present invention.

FIG. 4A is a flowchart depicting the operational steps of a geometryratio calculator, in accordance with an embodiment of the presentinvention.

FIG. 4B is an illustration of a partial geospatial shape within a fullshape, in accordance with an embodiment of the present invention.

FIG. 4C is an illustration of partial shape A within full shape Bprojected on distribution graph C, in accordance with an embodiment ofthe present invention.

FIG. 5 depicts a block diagram of components of an exemplary computersystem for implementing embodiments of the present invention.

DETAILED DESCRIPTION

As the amount of available geospatially keyed data increases, creatingrelevant geospatial query systems becomes more important, and canprovide a competitive edge amongst competitors. Embodiments of thepresent invention recognize that each geospatially keyed data set isoften prepared using a unique geometry; making queries of such data setsdifficult whenever the joining of two or more geospatial data sets isrequired. Current geospatial queries involving more than one geometry orshape set may miss data or count some data more than once. Embodimentsof the present invention provide for a geospatial query of geospatialdata sets utilizing a geometry ratio calculator, and an associateddistribution data set to optimize the summation of aggregated datawithin a joined data set. Implementation of embodiments of the inventionmay take a variety of forms, and exemplary implementation details arediscussed subsequently with reference to the figures.

As will be appreciated by one skilled in the art, aspects of the presentinvention may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present invention may take the formof an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer-readablemedium(s) having computer readable program code/instructions embodiedthereon.

Any combination of computer-readable media may be utilized.Computer-readable media may be a computer-readable signal medium or acomputer-readable storage medium. A computer-readable storage medium maybe, for example, but not limited to, an electronic, magnetic, optical,electromagnetic, infrared, or semiconductor system, apparatus, ordevice, or any suitable combination of the foregoing. More specificexamples (a non-exhaustive list) of a computer-readable storage mediumwould include the following: an electrical connection having one or morewires, a portable computer diskette, a hard disk, a random access memory(RAM), a read-only memory (ROM), an erasable programmable read-onlymemory (EPROM or Flash memory), an optical fiber, a portable compactdisc read-only memory (CD-ROM), an optical storage device, a magneticstorage device, or any suitable combination of the foregoing. In thecontext of this document, a computer-readable storage medium may be anytangible medium that can contain, or store a program for use by or inconnection with an instruction execution system, apparatus, or device.

A computer-readable signal medium may include a propagated data signalwith computer-readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer-readable signal medium may be any computer-readable medium thatis not a computer-readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer-readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent invention may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as Java®, Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on a user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).

Aspects of the present invention are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in acomputer-readable medium that can direct a computer, other programmabledata processing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer-readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce acomputer-implemented process such that the instructions which execute onthe computer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The present invention will now be described in detail with reference tothe figures. FIG. 1 is a block diagram illustrating a distributed dataprocessing environment, generally designated 100, in accordance with anembodiment of the present invention. Distributed data processingenvironment 100 includes server computers 102, 104, and 106, and clientcomputer 108, interconnected over network 110.

Network 110 can be, for example, a local area network (LAN), a wide areanetwork (WAN) such as the Internet, or a combination of the two, and caninclude wired, wireless, fiber optic, or any other connection known inthe art. In general, network 110 can be any combination of connectionsand protocols that may support communications between server computers102, 104, and 106, and client computer 108 in accordance with a desiredembodiment of the present invention.

Server computers 102, 104, and 106 can each respectively be aspecialized server computer, an application server, a laptop computer, atablet computer, a netbook computer, a personal computer (PC), a desktopcomputer, a personal digital assistant (PDA), a smart phone, or anyprogrammable electronic device capable of communicating with clientcomputer 108, and the remaining server computers via network 110. Incertain embodiments, server computers 102, 104, and 106 can eachrespectively represent a computer system utilizing clustered computersand components that act as a single pool of seamless resources whenaccessed via network 110, as is common in data centers and with cloudcomputing applications. In general, server computers 102, 104, and 106can each respectively be representative of any programmable electronicdevice or combination of programmable electronic devices capable ofexecuting machine-readable program instructions and communicating withother computing devices via network 110. Server computers 102, 104, and106 may each be a node in a distributed database management environment.Server computers 102, 104, and 106 may each include internal andexternal hardware components, as depicted and described in furtherdetail with respect to FIG. 5.

Server computer 102 includes geospatial application 300, geometry ratiocalculator 400, geospatial data 114, and a user interface, such as UI112. Geospatial application 300 uses UI 112 to receive user input, andto output responses to a user, such as a system administrator. In thedepicted environment, geospatial application 300 is a suite of softwaretools including, but not limited to, a spatial database managementsystem, authoring tools, viewing tools, deployment tools, and reportingtools. The spatial database management system includes an SQL parser, aquery optimizer, a query engine, and geometry ratio calculator 400. Inan embodiment of the present invention, geospatial application 300processes a query utilizing geometry ratio calculator 400 to join two ormore geospatial data sets with different geospatial map geometries withminimal loss or repetition of data. Geometry ratio calculator 400 may befully integrated, partially integrated or completely separate fromgeospatial application 300. Geometry ratio calculator 400 is describedfurther in FIG. 4A. Geospatial data 114 is a database of geospatiallykeyed data stored on server computer 102, or coupled to server computer102 via network 110. Geospatial application 300 accesses geospatial data116 and distribution data 118 via network 110. Geospatial application300 is described further in FIG. 2.

In an embodiment, UI 112 uses a combination of technologies and devices,such as device drivers, to provide a platform to enable users of servercomputer 102 to interact with geospatial applications 300. UI 112receives input, such as textual input received from a physical inputdevice, such as a keyboard or mouse, via a device driver thatcorresponds to the physical input device. UI 112 may utilize a web page,command line processor, or any other GUI to connect to geospatialapplication 300. For example, a database administrator may use a commandline processor via UI 112 to enter a data request in the form of an SQL(structured query language) statement.

Server computer 104 includes geospatial data 116. Geospatial data 116 isa database of geospatially keyed data stored on server computer 104, orcoupled to server computer 104 via network 110.

Server computer 106 includes distribution data 118. Distribution data118 is a database of geospatial related distribution data stored onserver computer 106, or coupled to server computer 106 via network 110.For example, the distribution data may cover the same geospatiallocations as geospatial data 114 or 116, but represents a different dataset, such as the distribution of buildable land versus water.

Client computer 108 includes client application 120 which executeslocally on client computer 108 and can interface with the user, via UI122 created by client application 120, for the purpose of data entry,storage and retrieval. In various embodiments of the present invention,client computer 108 can be a laptop computer, a tablet computer, anapplication server, a netbook computer, a personal computer (PC), adesktop computer, a personal digital assistant (PDA), a smartphone, orany programmable electronic device capable of communicating with servercomputers 102, 104, and 106 via network 110.

In the depicted environment, client application 120 uses UI 122 toreceive user input, and to output responses to a user. UI 122 mayutilize a web page application, a command line processor application, orany other graphical user interface (GUI). Client application 120 sendsinformation to and receives information from server computer 102 overnetwork 110. Client application 120 may be any program capable ofconnecting to geospatial application 300 and requesting geospatialapplication 300 to perform some task. Client application 120 may be anassociated client application created by the vendor or developer ofgeospatial application 300 for use in a server-client environment.Client application 120 may be part of a business intelligence (BI) andperformance management (PM) software suite providing report authoring ina graphical environment. The graphical environment may represent datasets with icons which the user can drag and drop onto each other tocreate queries.

User interface, UI 122, includes components used to receive input from auser and transmit the input to client application 120 residing on clientcomputer 108. In an embodiment, UI 122 uses a combination oftechnologies and devices, such as device drivers, to provide a platformenabling users of client computer 108 to interact with clientapplication 120. In various embodiments, UI 122 receives input, such astextual input received from a physical input device, such as a keyboardor mouse, via a device driver that corresponds to the physical inputdevice.

In the illustrative embodiment of FIG. 1, geometry ratio calculator 400,and geospatial data 114 are on server computer 102 with geospatialapplication 300. In other embodiments of the present invention,geospatial application 300, geometry ratio calculator 400, geospatialdata 114, geospatial data 116, and distribution data 118 may be on onecomputer, or more than one computer, and each item itself may be splitinto a plurality of parts and spread across more than one computer. Inany configuration, the following is maintained: geospatial application300 is connected to geospatial data 114, geospatial data 116,distribution data 118 and geometry ratio calculator 400.

In various embodiments, geospatial application 300 receives a requestfor data from a requestor over network 110, processes the request, andsends results back to the requestor. For example, geospatial application300 running on server computer 102 receives a request for data fromclient application 120 running on client computer 108 via network 110.Additionally a request for data may come from within geospatialapplication 300 running on server computer 102.

Geospatial application 300 formats the data request into a query whichrequires the joining of geospatial data 114 and geospatial data 116.Geospatial application 300 uses geometry ratio calculator 400 toapportion the requested data utilizing distribution data 118. Geospatialapplication 300 sends the requested data back to the originatingrequestor, i.e., client application 120, or a tool within geospatialapplication 300. Geometry ratio calculator 400 is described further inFIG. 4A.

FIGS. 2A-2E are illustrations of geospatial maps for the purpose ofdepicting a join of two geospatial data sets, in accordance with anembodiment of the present invention. In the illustrative embodiment,geospatial application 300 running on server computer 102 receives arequest for data from client application 120 running on client computer108 via network 110. The request includes criteria provided by the userfor selecting a subset of data from geospatial data 114 and geospatialdata 116.

FIG. 2A represents geospatial data 114, and may contain county censusdata, such as household income, number of people per residence, numberof houses per county, etc. In the illustrative example, the areaslabeled A through L represent individual counties. FIG. 2B representsgeospatial data 116, and may contain school district data includingmailing addresses, and number of school-age children. In the example,the areas labeled a through dd represent school districts. In anillustrative example, the user requests a subset of data from geospatialdata 114 and geospatial data 116 which includes the criteria of thefollowing: mailing addresses of residents with a median household incomeof $50,000, with a minimum of 2 school-age children, and living within alist of selected counties. To select the requested data, geospatialapplication 300 creates a query that requires a join of geospatial data114 with geospatial data 116.

Different geospatial data sets can use different methods for aggregationof the data which create different shapes represented on a map. In theexample, both FIG. 2A and FIG. 2B are keyed using the same (X,Y)coordinate system encompassing the same physical location, but FIG. 2Auses rectangular shapes to divide up the data while FIG. 2B uses curvedshapes. The overlap of the shape sets of FIG. 2A and FIG. 2B can be seenin FIG. 2C. The shapes within FIG. 2A meeting the example criteria, suchas the list of selected counties, include full shapes A, B, C, E, F, andG, which form a composite, or target shape illustrated in FIG. 2C byarea 200. The shapes in FIG. 2B which meet the example criteria includethe full shapes of a, b, c, d, f, g, h, i, k, 1, m, n, and q, andportions of shapes e, j, o, p, r, s, and t, also illustrated in FIG. 2Cby area 200.

Spatial database management systems in common geospatial applications,following Open Geospatial Consortium standards, allow relational joinsbetween two geospatial data tables with different “shape sets” to becompleted based on the intersection of their geometries. Geometry is adata type within spatial database management systems representing theshapes seen on geospatial data maps which bound aggregated data astwo-dimensional objects. The shapes are defined by points or collectionsof points on the map which may represent lines, boxes, paths, orpolygons. Spatial database management systems allow for spatial extendedoperations to be performed on geospatial database tables.

For example, a set intersection query is expressed as:ST_CONTAINS({A,B,C,E,F,G}, {a.dd}) where {A,B,C,E,F,G} is a sub-set ofselected “rectangular” shapes from geospatial data 114 which form atarget shape, and {a.dd} is a complete set of “curved” shapes fromgeospatial data 116. The intersection query is requesting all fullshapes from geospatial data 116 that are completely enclosed in thecomposite shape described by {A,B,C,E,F,G}. The result set of theintersection query is {a,b,c,d,f,g,h,i,k,l,m,n,q} illustrated in FIG. 2Dby area 202.

A set union query is expressed as: ST_OVERLAPS({A,B,C,E,F,G}, {a.dd})where {A,B,C,E,F,G} is a sub-set of selected “rectangular” shapes fromgeospatial data 114 which form a target shape, and {a.dd} is a completeset of “curved” shapes from geospatial data 116. The union query isrequesting all full shapes from geospatial data 116 that have at leastsome portion of a shape overlapping any part of the composite shapedescribed by {A,B,C,E,F,G}. The result set of the union query is{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t} illustrated in FIG. 2D by area204.

Both the set intersection query and the set union query produce resultsets comprised of full shapes from geospatial data 116, respectivelyarea 202, and area 204 in FIG. 2D. The standard geospatial query processdoes not produce result sets comprising partial shapes. In theillustrative example, the optimal result set contains full shapes of{a,b,c,d,f,g,h,i,k,l,m,n,q}, and the partial shapes of {e,j,o,p,r,s,t}from geospatial data 116, identified by the overlap of the target shape{A,B,C,E,F,G} related to geospatial data 114. The target result set isillustrated in FIG. 2C by area 200. Embodiments of the present inventionprovide a spatial database management system which includes a setintersection query operation capable of determining a result set of fulland partial shapes which matches area 200, instead of area 202 or area204. One skilled in the art will recognize that area 202 is missing areafrom area 200, and that area 204 includes more area than area 200.

Embodiments of the present invention disclose a method to apportion thedata within partial shapes using a separate distribution data set, suchas distribution data 118 in FIG. 2E, to best approximate the result set.Distribution data 118 shares the same geometry as one of the geospatialdata sets from the query, or has a geometry of sufficient granularitythat the shapes of the shape set combine to fit perfectly within thegeometry of at least one of the geospatial data sets, such as very smallsquares, or individual points. In the illustration, distribution data118 shares the same “shape set” or geometry as geospatial data 114. Thedata in each shape of geospatial data 114 is summary data which cannotbe re-queried for the individual data points. Census demographic data istypically summary data within each shape on the geospatial map.Distribution data 118 is not summary data, but represents density ordistribution of one or more variables within each shape. Distributiondata 118 may include variables, such as residential vs. commercialproperty, land vs. water, or simply population, and may not relateexactly to the original distribution of data in geospatial data 114.

Geometry ratio calculator 400 determines the value of a select variablefrom distribution data 118 found within the area of a shape ofgeospatial data 114. Geometry ratio calculator 400 determines a ratiousing values from the distribution data 118 related to the area of thepartial shape being processed compared to the area of the full shapewhich fully encloses the partial shape. Geometry ratio calculator 400multiplies the determined ratio with the values of the summary datawithin the full shape of geospatial data 114 to apportion the summarydata for the partial shape. Geospatial application 300 creates theresult set, which is a compilation of the data from the full shapes ofgeospatial data 114 and geospatial data 116, and the apportioned datafrom the partial shapes of geospatial data 116.

FIG. 2F is an illustration of a target shape overlaid onto a singlegeospatial data set, in accordance with an alternate embodiment of thepresent invention. Geospatial application 300 running on server computer102 receives a request for data from client application 120. In theillustration of an alternate embodiment, the request for data includescriteria provided by the user for selecting a subset of data from asingle spatial data set, such as geospatial data 114. The criteriaincludes a target shape, such as area 206, overlaid on a maprepresenting geospatial data 114 as shown in FIG. 2F. Instead of beingdefined by a composite of shapes from a geospatial data set, a usercreates the target shape as an arbitrary shape with a geometry differentfrom the geometry of geospatial data 114.

Geospatial application 300 determines the full and partial shapes ofgeospatial data 114 within the target shape, or area 206. Distributiondata 118 of FIG. 2E shares the same geometry as geospatial data 114 ofFIG. 2A. Geometry ratio calculator 400 selects a variable ofdistribution data 118 found within the area of a shape of geospatialdata 114. Geometry ratio calculator 400 determines a ratio using valuesfrom the distribution data 118 related to the area of the partial shapebeing processed compared to the area of the full shape which fullyencloses the partial shape. Geometry ratio calculator 400 multiplies thedetermined ratio with the values of the summary data within the fullshape of geospatial data 114 to apportion the summary data for thepartial shape. Geospatial application 300 creates the result set, whichis a compilation of the data encompassed within the full shapes, and theapportioned data from the partial shapes of geospatial data 114.

FIG. 3 is a flowchart depicting the operational steps of geospatialapplication 300, in accordance with an embodiment of the presentinvention. In the illustrative embodiment, geospatial application 300running on server computer 102 receives a request for data whichrequires the joining of two geospatial databases including geospatialdata 114 on server computer 102, and geospatial data 116 on servercomputer 104 available via network 110.

Geospatial application 300 receives a data request including criteria toselect data within geospatial data 114 and geospatial data 116 (step302). In the illustrative embodiment, geospatial application 300 runningon server computer 102 receives a request for data from a user of clientapplication 120 running on client computer 108 via network 110. In analternate embodiment, the request for data may come from withingeospatial application 300 on server computer 102, for example, adatabase administrator developing a new report, or publishing a testedreport for use in the production environment.

The data request includes criteria for selecting a subset of data fromwithin geospatial data 114 and geospatial data 116 which matches thecriteria. To select the requested data, geospatial application 300creates a query that includes a join of geospatial data 114 withgeospatial data 116. A join is an operation used within relationaldatabases to connect different tables of information by using valuescommon to each. The join operation creates a result set that can besaved as a separate table, or used at that instance and then discarded.

Geospatial application 300 determines a target shape from criteria anddefines the target shape in coordinates of geospatial data (step 304). Ajoin between two databases requires fields common to each, but in thecase of two geospatial databases where data is summarized or aggregatedby different methods, the common fields are related to the shape sets orgeometry type of each geospatial map. The methods for aggregation ofdata create different shapes represented on a map while using the same(X,Y) coordinate system. In the preceding example, geospatial data 114had “rectangular” shapes, and geospatial data 116 had “curved” shapes.In the illustrative embodiment, geospatial application 300 uses criteriaprovided by the user to determine a target shape of the result set,which in the example, relates to the shapes within geospatial data 114corresponding to a list of selected counties. The composite of theseselected shapes becomes the target shape and is defined in thegeospatial (X,Y) coordinate system. In an alternate embodiment, thetarget shape may be a complex polygon drawn by the user onto ageospatial map, and may be part of the criteria provided by the user forselecting a subset of data from one or both of geospatial data 114 andgeospatial data 116.

Geospatial application 300 determines if the shape sets align for allgeospatial data, such as geospatial data 114 and geospatial data 116(decision block 306). Geospatial application 300 identifies all shapeswithin each geospatial database being queried. The shapes are defined inthe geospatial databases by points or collections of points whichrepresent points, lines, or polygons. Spatial tests exist that determineif one defined shape is completely located within another defined shape.Geospatial application 300 compares each shape definition fromgeospatial data 114 to all the defined shapes within geospatial data 116to determine if the shape sets are equivalent and align, or aredifferent and do not align.

If geospatial application 300 determines the shape sets do align forgeospatial data 114 and geospatial data 116 (yes branch, decision block306), geospatial application 300 performs a standard spatial querywithout optimization (step 320). If the shape sets for each databasealign, then the spatial query cannot be optimized further. The bordersof shapes for both geospatial data 114 and geospatial data 116 wouldeither have to be exactly the same, by having the same geospatialdefinitions of shapes, or the shapes of one geospatial database wouldhave to be smaller and granular enough to form composite shapes thatmatch the borders of shapes in the other geospatial database. If theborders align, no partial shapes will be found, and geospatialapplication 300 performs a standard query without needing to apportionshapes.

If geospatial application 300 determines the shape sets do not align forgeospatial data 114 and geospatial data 116 (no branch, decision block306), geospatial application 300 determines whether a matchingdistribution data set exists (decision block 308). If the borders ofgeospatial data 114 and geospatial data 116 do not align, partial shapeswill be determined as part of the query, and geospatial application 300may utilize a distribution data set, such as distribution data 118, tooptimize the query using embodiments of the present invention.Distribution data 118 must align with at least one geospatial database,such as geospatial data 114, in order to apportion aggregated data forpartial shapes within the target shape. In the example, geospatialapplication 300 compares each shape definition from geospatial data 114to all the defined shapes within distribution data 118 to determine ifthe shape sets are equivalent and align, or are different and do notalign.

If geospatial application 300 determines a matching distribution dataset does not exist (no branch, decision block 308), geospatialapplication 300 performs a standard spatial query without optimization(step 320). Without a matching distribution data set, geometry ratiocalculator 400 will not be able to apportion aggregated data within anypartial shapes.

If geospatial application 300 determines a matching distribution dataset does exist (yes branch, decision block 308), geospatial application300 determines the set of full shapes from geospatial data 116completely inside the target shape (step 310). The target shape is acomposite of selected shapes from geospatial data 114, which whenoverlaid onto geospatial data 116 includes both full and partial shapesfrom geospatial data 116. To find the set of full shapes from geospatialdata 116, geospatial application 300 performs an intersection query, asillustrated in the preceding example.

In the illustrative embodiment, geospatial application 300 determinesthe set of partial shapes from geospatial data 116 within the targetshape (step 312). First, geospatial application 300 performs a unionquery, as illustrated in the preceding example, which includes allshapes of geospatial data 116 touching and partially overlapping thetarget shape. Geospatial data 300 subtracts the result of theintersection query from the result of the union query to determine theset of partial shapes from geospatial data 116 inside the target shape.

In an alternate embodiment, the function of determining the set ofpartial shapes inside the target shape may be performed in one stepthrough the use of a new operation defined in geospatial application300. This may be an extension of the spatial database management systemwhich includes a new query format that allows this type of query or joinautomatically.

Geospatial application 300 sends a request to geometry ratio calculator400 to apportion data in each partial shape (step 314). Geospatialapplication 300 sends each partial shape, either one at a time using alooping algorithm, or as a group to geometry ratio calculator 400.Geometry ratio calculator 400 takes each partial shape and creates anapportioned set of aggregated data utilizing a matching distributiondata set. Geometry ratio calculator 400 is described further in FIG. 4A.

Geospatial application 300 receives apportioned data from geometry ratiocalculator 400 (step 316). Geospatial application 300 receivesapportioned data for each partial shape for each aggregated variable ingeospatial data 116 from geometry ratio calculator 400. Geospatialapplication 300 receives apportioned data for each shape, either one ata time, or as a group from geometry ratio calculator 400.

Geospatial application 300 accumulates the data from full shapes and theapportioned data from partial shapes to form a result set (step 318).The result set can be saved as a separate table, or used at thatinstance and then discarded. Geospatial application 300 collects theaggregate data from both full and partial shapes to form a data set thatmay then be queried with the original criteria provided by the user.

Geospatial application 300 passes the requested data to the originalrequestor (step 322). Geospatial application 300 running on servercomputer 102 passes the requested data to the originating requestor,such as a user of client application 120 running on client computer 108via network 110, or an administrative user of geospatial application 300on server computer 102. The result set may eventually be published aspart of a report for use in a production environment, and may be usedfor further refined queries by a user of client application 120.

FIG. 4A is a flowchart depicting the operational steps of geometry ratiocalculator 400, in accordance with an embodiment of the presentinvention. Geometry ratio calculator 400 takes a partial shape from ageospatial database, such as geospatial data 116, within a full shapefrom another geospatial database, such as geospatial data 114, andcreates an apportioned set of aggregated data utilizing a matchingdistribution data set, such as distribution data 118.

Geometry ratio calculator 400 receives a request from geospatialapplication 300 to apportion data for each partial shape inside thetarget shape (step 402). Area 420 illustrates partial shape A in FIG.4B. In the illustrative embodiment of the present invention, geospatialapplication 300 passes one partial shape for processing by geometryratio calculator 400. In other embodiments, geospatial application 300passes the list of partial shapes inside the target shape for processingby geometry ratio calculator 400. The illustrated flow of geometry ratiocalculator 400, shown in FIG. 4A, follows the processing of one partialshape, but one skilled in the art will recognize that all the partialshapes inside the target shape may be processed as a group in a similarfashion.

Geometry ratio calculator 400 identifies full shape B containing partialshape A (step 404). Partial shape A from geospatial data 116, is definedto be completely encompassed by full shape B from geospatial data 114,illustrated by area 418 in FIG. 4B. Geometry ratio calculator 400identifies the full shape from geospatial data 114 by using spatialextended operations within the spatial database management system. Theshapes are defined in the geospatial databases by points or collectionsof points which represent points, lines, or polygons. Spatial testsexist that determine if one defined shape is completely located withinanother defined shape. Geometry ratio calculator 400 compares thepartial shape A definition from geospatial data 116 to all the definedshapes within geospatial data 114 to identify full shape B whichcontains partial shape A.

Geometry ratio calculator 400 identifies the distribution graph ofidentified full shape B (step 406). In the illustrative embodiment ofthe present invention, distribution data 118 of FIG. 2E shares the samegeometry as geospatial data 114 of FIG. 2A, and thus contains a fullshape that shares the same geospatial definition as full shape B.Geometry ratio calculator 400 uses spatial tests to identify the fullshape C, shown as area 422 in FIG. 4C, that shares the same geospatialoutline as full shape B. In other embodiments, distribution data may notshare the same geometry as geospatial data 114, but may include smallershapes that can combine to form a composite shape that is equivalent tofull shape B. In some embodiments, the smaller shapes may includepoints. Geometry ratio calculator 400 may use spatial queries todetermine the composite shape that would be equivalent to full shape B,or C in FIG. 4C.

Geometry ratio calculator 400 determines the boundary curve between fullshape B and partial shape A (step 408). Geometry ratio calculator 400uses the geospatial definitions for partial shape A and full shape B todetermine the boundary curve that separates partial shape A from theremainder of full shape B. The boundary curve is projected onto fullshape C to enable calculation of the distribution data within full shapeC that corresponds to the areas of partial shape A and full shape B.

Geometry ratio calculator 400 calculates the volume for partial shape A,V_(A), which is equal to the volume under distribution graph C withinthe area for partial shape A (step 410). Geometry ratio calculator 400projects the area for partial shape A in two dimensions ontodistribution graph C, which includes three dimensions. Geometry ratiocalculator 400 calculates the volume under distribution graph C withinthe boundaries of the projected area of partial shape A, andperpendicular to the projection of partial shape A.

Geometry ratio calculator 400 calculates the volume for full shape B,V_(B), which is equal to the volume under distribution graph C withinthe area for full shape B (step 412). Geometry ratio calculator 400projects the area for full shape B in two dimensions onto distributiongraph C, which includes three dimensions. Geometry ratio calculator 400calculates the volume under distribution graph C within the boundariesof the projected area of full shape B, and perpendicular to theprojection of full shape B. In some embodiments, distribution graph C isthe same shape as full shape B in two dimensions, which is the same asthe area for full shape B projected onto distribution graph C.

Geometry ratio calculator 400 apportions data for partial shape A usingthe following equation: X_(A)=X_(B)*(V_(A)/V_(B)) (step 414). Geometryratio calculator 400 apportions data for partial shape A utilizing thefollowing variables: X_(B), V_(A), and V_(B). X_(B) is the full value ofan aggregated variable within geospatial data 114 for full shape B.V_(A) is the volume of distribution graph C related to partial shape A,and calculated in step 410. V_(B) is the volume of distribution graph Crelated to full shape B, and calculated in step 412. X_(A) is theapportioned value of an aggregated variable within geospatial data 116for partial shape A, and is multiplied by the ratio (V_(A)/V_(B)).Geometry ratio calculator 400 calculates X_(A) for each summarized oraggregated variable within geospatial data 116. The result includes anapportioned value for all the aggregated variables related to eachpartial shape. A person of ordinary skill in the art may recognize thatthere are other ways to calculate a ratio from distribution data forapportioning data within a partial shape of a spatial data set.

Geometry ratio calculator 400 passes requested apportioned data togeospatial application 300 (step 416). Geometry ratio calculator 400passes the apportioned data to the requestor, such as Geospatialapplication 300 running on server computer 102. The apportioned data maybe passed for one partial shape at a time, or for several partialshapes, depending on the original request.

FIG. 4B is an illustration of a partial geospatial shape within a fullshape, in accordance with an embodiment of the present invention. Area420 illustrates partial shape A in FIG. 4B. Partial shape A fromgeospatial data 116, is completely encompassed by full shape B fromgeospatial data 114, illustrated by area 418 in FIG. 4B. The aggregateddata of full shape B can not be re-queried to divide the values of thedata variables into values for partial shape A, or values for theremainder of full shape B. For example, the number of houses per countyis a variable in geospatial data 114 that is summarized for the fullshape B as a value of 14,500. The details of where those housesphysically are within full shape B is no longer available, and thus cannot be re-queried. A simple ratio of the area of partial shape A to fullshape B could be used to apportion the data within partial shape A, butthose skilled in the art will recognize that this can lead to skeweddata.

FIG. 4C is an illustration of partial shape A within full shape Bprojected on distribution graph C, in accordance with an embodiment ofthe present invention. The projection of partial shape A is shown as420′, and the projection of full shape B is shown as 418′ in FIG. 4C. Inthe illustrative example, if the area within the remainder of full shapeB is mostly water, then using a simple ratio, such as the area of A tothe area of B, to determine the number of houses per county withinpartial shape A will produce a value much lower than the actual number.By using distribution data C, within area 422, which includes densityinformation about useable land versus water, geometry ratio calculator400 produces a value much closer to the actual number of houses withinthe area of partial shape A.

FIG. 5 depicts a block diagram of components of server computer 102 inaccordance with an illustrative embodiment of the present invention. Itmay be appreciated that FIG. 5 provides only an illustration of oneimplementation and does not imply any limitations with regard to theenvironments in which different embodiments may be implemented. Manymodifications to the depicted environment may be made.

Server computer 102 includes communications fabric 502, which providescommunications between computer processor(s) 504, memory 506, persistentstorage 508, communications unit 510, and input/output (I/O)interface(s) 512. Communications fabric 502 can be implemented with anyarchitecture designed for passing data and/or control informationbetween processors (such as microprocessors, communications and networkprocessors, etc.), system memory, peripheral devices, and any otherhardware components within a system. For example, communications fabric502 can be implemented with one or more buses.

Memory 506 and persistent storage 508 are computer-readable storagemedia. In this embodiment, memory 506 includes random access memory(RAM) 514 and cache memory 516. In general, memory 506 can include anysuitable volatile or non-volatile computer-readable storage media.

Geospatial application 300, geometry ratio calculator 400, geospatialdata 114, geospatial data 116, and distribution data 118 are stored inpersistent storage 508 for execution and/or access by one or more of therespective computer processors 504 via one or more memories of memory506. Geospatial application 300 has access to geometry ratio calculator400, geospatial data 114, geospatial data 116, and distribution data118. In this embodiment, persistent storage 508 includes a magnetic harddisk drive. Alternatively, or in addition to a magnetic hard disk drive,persistent storage 508 can include a solid state hard drive, asemiconductor storage device, read-only memory (ROM), erasableprogrammable read-only memory (EPROM), flash memory, or any othercomputer-readable storage media that is capable of storing programinstructions or digital information.

The media used by persistent storage 508 may also be removable. Forexample, a removable hard drive may be used for persistent storage 508.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer-readable storage medium that is also part of persistent storage508.

Communications unit 510, in these examples, provides for communicationswith other data processing systems or devices, including resources ofserver computers 102, 104, and 106, and client computer 108. In theseexamples, communications unit 510 includes one or more network interfacecards. Communications unit 510 may provide communications through theuse of either or both physical and wireless communications links.Geospatial application 300, geometry ratio calculator 400, geospatialdata 114, geospatial data 116, and distribution data 118 may bedownloaded to persistent storage 508 through communications unit 510.

I/O interface(s) 512 allows for input and output of data with otherdevices that may be connected to server computer 102. For example, I/Ointerface 512 may provide a connection to external device(s) 518 such asa keyboard, a keypad, a touch screen, and/or some other suitable inputdevice. External device(s) 518 can also include portablecomputer-readable storage media such as, for example, thumb drives,portable optical or magnetic disks, and memory cards. Software and dataused to practice embodiments of the present invention, e.g., geospatialapplication 300, geometry ratio calculator 400, geospatial data 114,geospatial data 116, and distribution data 118 can be stored on suchportable computer-readable storage media and can be loaded ontopersistent storage 508 via I/O interface(s) 512. I/O interface(s) 512also connect to a display 520.

Display 520 provides a mechanism to display data to a user and may be,for example, a computer monitor.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

What is claimed is:
 1. A method for optimizing spatial queries, themethod comprising: a computer receiving a first spatial data set and atarget spatial shape, wherein a geometry of the first spatial data setdoes not align with a geometry of the target spatial shape; the computerreceiving a distribution data set, wherein the geometry of thedistribution data set aligns with the geometry of the first spatial dataset; the computer performing a query to determine a list of full andpartial shapes of the first spatial data set which are located withinthe target spatial shape; the computer determining a ratio for adetermined partial shape of the first spatial data set using thedistribution data set; the computer determining an apportioned value ofa variable of the first spatial data set within the determined partialshape, wherein the apportioned value of the variable is based on a fullvalue of the variable and the determined ratio; and the computersummarizing into a result set the value of the variable within thedetermined list of full and partial shapes of the first spatial dataset.
 2. The method of claim 1, further comprising: the computerdetermining whether the geometry of the first spatial data set does notalign with the geometry of the target spatial shape, wherein i.) thegeometry of the first spatial data set includes at least one shapedefined by points, lines, or polygons, ii.) the geometry of the targetspatial shape includes at least one shape defined by points, lines, orpolygons, iii.) the first spatial data set encompasses the targetspatial shape, and iv.) a sub-set of one or more full shapes within thefirst spatial data set cannot be combined to form a composite shapeequivalent to the target spatial shape.
 3. The method of claim 1,further comprising: the computer determining whether the geometry of thedistribution data set aligns with the geometry of the first spatial dataset, wherein i.) the geometry of the distribution data set includes atleast one shape defined by points, lines, or polygons, and ii.) asub-set of one or more full shapes within the distribution data set canbe combined to form a composite shape equivalent to each full shapewithin the first spatial data set.
 4. The method of claim 1, wherein thecomputer determining a ratio for a determined partial shape of the firstspatial data set using the distribution data set comprises: the computeridentifying a full shape of the first spatial data set which encompassesthe determined partial shape of the first spatial data set; the computeridentifying a composite shape of the distribution data set which isequivalent to the identified full shape of the first spatial data set;the computer determining a boundary curve that separates the identifiedfull shape of the first spatial data set with the determined partialshape of the first spatial data set; and the computer determining aratio of a data density from the distribution data set within thedetermined partial shape of the first spatial data set compared to adata density from the distribution data set within the identifiedcomposite shape of the distribution data set.
 5. The method of claim 4,further comprising: the computer determining the data density from thedistribution data set by calculating a volume under a graph of thedistribution data set.
 6. The method of claim 1, further comprising: thecomputer receiving a second spatial data set, wherein the geometry ofthe first spatial data set does not align with the geometry of thesecond spatial set; and the computer performing a query to determine alist of full and partial shapes from the second spatial data set whichare located within the target spatial shape.
 7. The method of claim 1,further comprising: the computer receiving a second spatial data set andcriteria which defines the target spatial shape from a sub-set of one ormore full shapes within the second spatial data set.
 8. A computerprogram product for optimizing spatial queries, the computer programproduct comprising: one or more computer-readable storage media andprogram instructions stored on the one or more computer-readable storagemedia, the program instructions comprising: program instructions toreceive a first spatial data set and a target spatial shape, wherein ageometry of the first spatial data set does not align with a geometry ofthe target spatial shape; program instructions to receive a distributiondata set, wherein the geometry of the distribution data set aligns withthe geometry of the first spatial data set; program instructions toperform a query to determine a list of full and partial shapes of thefirst spatial data set which are located within the target spatialshape; program instructions to determine a ratio for a determinedpartial shape of the first spatial data set using the distribution dataset; program instructions to determine an apportioned value of avariable of the first spatial data set within the determined partialshape, wherein the apportioned value of the variable is based on a fullvalue of the variable and the determined ratio; and program instructionsto summarize into a result set the value of the variable within thedetermined list of full and partial shapes of the first spatial dataset.
 9. The computer program product of claim 8, further comprising:program instructions to determine whether the geometry of the firstspatial data set does not align with the geometry of the target spatialshape, wherein i.) the geometry of the first spatial data set includesat least one shape defined by points, lines, or polygons, ii.) thegeometry of the target spatial shape includes at least one shape definedby points, lines, or polygons, iii.) the first spatial data setencompasses the target spatial shape, and iv.) a sub-set of one or morefull shapes within the first spatial data set cannot be combined to forma composite shape equivalent to the target spatial shape.
 10. Thecomputer program product of claim 8, further comprising: programinstructions to determine whether the geometry of the distribution dataset aligns with the geometry of the first spatial data set, wherein i.)the geometry of the distribution data set includes at least one shapedefined by points, lines, or polygons, and ii.) a sub-set of one or morefull shapes within the distribution data set can be combined to form acomposite shape equivalent to each full shape within the first spatialdata set.
 11. The computer program product of claim 8, wherein programinstructions to determine a ratio for a determined partial shape of thefirst spatial data set using the distribution data set comprises:program instructions to identify a full shape of the first spatial dataset which encompasses the determined partial shape of the first spatialdata set; program instructions to identify a composite shape of thedistribution data set which is equivalent to the identified full shapeof the first spatial data set; program instructions to determine aboundary curve that separates the identified full shape of the firstspatial data set with the determined partial shape of the first spatialdata set; and program instructions to determine a ratio of a datadensity from the distribution data set within the determined partialshape of the first spatial data set compared to a data density from thedistribution data set within the identified composite shape of thedistribution data set.
 12. The computer program product of claim 11,further comprising: program instructions to determine the data densityfrom the distribution data set by calculating a volume under a graph ofthe distribution data set.
 13. The computer program product of claim 8,further comprising: program instructions to receive a second spatialdata set, wherein the geometry of the first spatial data set does notalign with the geometry of the second spatial set; and programinstructions to perform a query to determine a list of full and partialshapes from the second spatial data set which are located within thetarget spatial shape.
 14. The computer program product of claim 8,further comprising: program instructions to receive a second spatialdata set and criteria which defines the target spatial shape from asub-set of one or more full shapes within the second spatial data set.15. A computer system for optimizing spatial queries, the computersystem comprising: one or more computer processors; one or morecomputer-readable storage media; program instructions stored on thecomputer-readable storage media for execution by at least one of the oneor more processors, the program instructions comprising: programinstructions to receive a first spatial data set and a target spatialshape, wherein a geometry of the first spatial data set does not alignwith a geometry of the target spatial shape; program instructions toreceive a distribution data set, wherein the geometry of thedistribution data set aligns with the geometry of the first spatial dataset; program instructions to perform a query to determine a list of fulland partial shapes of the first spatial data set which are locatedwithin the target spatial shape; program instructions to determine aratio for a determined partial shape of the first spatial data set usingthe distribution data set; program instructions to determine anapportioned value of a variable of the first spatial data set within thedetermined partial shape, wherein the apportioned value of the variableis based on a full value of the variable and the determined ratio; andprogram instructions to summarize into a result set the value of thevariable within the determined list of full and partial shapes of thefirst spatial data set.
 16. The computer system of claim 15, furthercomprising: program instructions to determine whether the geometry ofthe first spatial data set does not align with the geometry of thetarget spatial shape, wherein i.) the geometry of the first spatial dataset includes at least one shape defined by points, lines, or polygons,ii.) the geometry of the target spatial shape includes at least oneshape defined by points, lines, or polygons, iii.) the first spatialdata set encompasses the target spatial shape, and iv.) a sub-set of oneor more full shapes within the first spatial data set cannot be combinedto form a composite shape equivalent to the target spatial shape. 17.The computer system of claim 15, further comprising: programinstructions to determine whether the geometry of the distribution dataset aligns with the geometry of the first spatial data set, wherein i.)the geometry of the distribution data set includes at least one shapedefined by points, lines, or polygons and ii.) a sub-set of one or morefull shapes within the distribution data set can be combined to form acomposite shape equivalent to each full shape within the first spatialdata set.
 18. The computer system of claim 15, wherein programinstructions to determine a ratio for a determined partial shape of thefirst spatial data set using the distribution data set comprises:program instructions to identify a full shape of the first spatial dataset which encompasses the determined partial shape of the first spatialdata set; program instructions to identify a composite shape of thedistribution data set which is equivalent to the identified full shapeof the first spatial data set; program instructions to determine aboundary curve that separates the identified full shape of the firstspatial data set with the determined partial shape of the first spatialdata set; and program instructions to determine a ratio of a datadensity from the distribution data set within the determined partialshape of the first spatial data set compared to a data density from thedistribution data set within the identified composite shape of thedistribution data set.
 19. The computer system of claim 18, furthercomprising: program instructions to determine the data density from thedistribution data set by calculating a volume under a graph of thedistribution data set.
 20. The computer system of claim 15, furthercomprising: program instructions to receive a second spatial data set,wherein the geometry of the first spatial data set does not align withthe geometry of the second spatial set; and program instructions toperform a query to determine a list of full and partial shapes from thesecond spatial data set which are located within the target spatialshape.